﻿using System.Configuration;

namespace PrismicIOAPI.Util
{
    public class SiteSettings
    {
        public static int PrismicCacheTimeout
        {
            get
            {
                int _defaultCacheTimeout = 15;
                if( ConfigurationManager.AppSettings[ "CacheTimeout" ] != null )
                {
                    if( !int.TryParse( ConfigurationManager.AppSettings[ "CacheTimeout" ] , out _defaultCacheTimeout ) )
                    {
                        _defaultCacheTimeout = 15;
                    }
                }
                return _defaultCacheTimeout;
            }
        }
        public static string PrismicCdn
        {
            get
            {
                return ConfigurationManager.AppSettings[ "Prismic.CDN" ].ToString();
            }
        }

        public static string PrismicToken
        {
            get
            {
                return ConfigurationManager.AppSettings[ "Prismic.Token" ].ToString();
            }
        }

        public static string PrismicRelease
        {
            get
            {
                return ConfigurationManager.AppSettings[ "Prismic.Release" ].ToString();
            }
        }

        public static string LiveSiteUrl
        {
            get
            {
                if( ConfigurationManager.AppSettings[ "LiveSiteUrl" ] == null )
                {
                    return null;
                }
                return ConfigurationManager.AppSettings[ "LiveSiteUrl" ].ToString();
            }
        }

        public static string LiveSiteSecondUrl
        {
            get
            {
                if( ConfigurationManager.AppSettings[ "LiveSiteSecondUrl" ] == null )
                {
                    return null;
                }
                return ConfigurationManager.AppSettings[ "LiveSiteSecondUrl" ].ToString();
            }
        }
    }
}
